<template>
<div :class="$style.mytable">
      <el-table
    :data="tableData.filter(data => !search || data.goodsname.toLowerCase().includes(search.toLowerCase()))"
    style="width: 100%"
    height="250"
    highlight-current-row
    border
    >
        <el-table-column
      prop="goodsid"
      label="货品ID"
      width="70"
      >
    </el-table-column>
    <el-table-column
      prop="goodsname"
      label="通用名">
    </el-table-column>
    <el-table-column
      prop="currencyname"
      label="商品名">
    </el-table-column>
    <el-table-column
      prop="goodstype"
      label="规格"
      width="90">
    </el-table-column>
    <el-table-column
      prop="factoryname"
      label="生产厂家">
    </el-table-column>
    <el-table-column
      prop="usestatus"
      label="使用状态"
      width="80">
    </el-table-column>
    <el-table-column
      prop="goodsunit"
      label="单位"
      width="50"
      >
    </el-table-column>
    <el-table-column  width="170">
      <template slot="header" slot-scope="scope">
        <el-input v-model="search" size="mini" placeholder="输入通用名搜索">
      </el-input>
      </template>
      <template slot-scope="scope">
        <el-button type="primary"
          size="mini"
          @click="handlechose(scope.row.goodsid)">选择</el-button>
      </template>
    </el-table-column>
  </el-table>

</div>
 
</template>

<script>
export default {
  data() {
    return { search: '' };
  },
  props: ["tableData", "tableKey"],
  methods: {
    handlechose: function (params) {
      this.$message('选择的是'+ params)
      this.$emit("listenTochose", params)
    }
  }
};
</script>

<style lang="scss" module>
</style>